#include <stdio.h>
#include <string.h>

int main()
{
    char name[100] = {0};
    char passwd[100] ={0};
    int count = 3;
    while(1)
    {
        printf("还可以登录的次数：%d\n",count);
        printf("Name:");
        scanf("%s",name);
        printf("Passwd:");
        scanf("%s",passwd);
        if(strcmp(name,"test") == 0 && strcmp(passwd,"123456") == 0)
            break;
        else{
            count--;
            if(count == 0)
                exit(-1);
        }
    }

//    do
//    {
//        printf("还可以登录的次数：%d",count);
//        printf("Name:");
//        scanf("%s",name);
//        printf("Passwd:");
//        scanf("%s",passwd);
//    }while (!(strcmp(name,"test") == 0 && strcmp(passwd,"123456") == 0));
    printf("欢迎登录!\n");
    return 0;
}
